/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package coms.delegates;

import EJB.EJBLocator;
import coms.dto.Conference;
import coms.dto.ConferenceItemBooking;
import coms.dto.User;
import coms.ejb.ConferenceItemBeanRemote;
import coms.ejb.ConferenceItemBookingBeanRemote;
import java.util.List;
import java.util.logging.Level;
import java.util.logging.Logger;

/**
 *
 * @author Pk
 */
public class ConferenceItemBookingDelegate implements IDelegate<ConferenceItemBooking> {

    private ConferenceItemBookingBeanRemote conferenceItemBookingBean;

    public ConferenceItemBookingDelegate() {
        try {
            this.conferenceItemBookingBean = EJBLocator.lookupConferenceItemBookingBean();
        } catch (Exception ex) {
            Logger.getLogger(ConferenceItemDelegate.class.getName()).log(Level.SEVERE, null, ex);
        }
    }

    @Override
    public boolean create(ConferenceItemBooking t){
        try
        {
            conferenceItemBookingBean.create(t);
            return true;
        }catch(Exception e)
        {
            return false;
        }        
    }

    @Override
    public boolean update(ConferenceItemBooking t){
        return conferenceItemBookingBean.update(t);
    }

    @Override
    public boolean delete(ConferenceItemBooking t){
        return conferenceItemBookingBean.delete(t);                
    }

    @Override
    public List<ConferenceItemBooking> search(ConferenceItemBooking t) {
        return conferenceItemBookingBean.search(t);
    }

    @Override
    public List<ConferenceItemBooking> findAll(){
        return conferenceItemBookingBean.findAll();
    }

    @Override
    public ConferenceItemBooking getById(int id){
        return conferenceItemBookingBean.getById(id);
    }
    public List<ConferenceItemBooking> getConferenceItemBookingByParticipant(User u,Conference c)
    {
        return conferenceItemBookingBean.getByConferenceAndParticipant(u, c);
    }
}
